/**
 * Craeted with IntelliJ IDEA.
 * Description:
 * User:23687
 * Date:2024-09-24
 * Time:8:34
 */import java.util.Scanner;
/*public class TestDemo {
   *//* public static void main1(String[] args){
        Scanner sc=new Scanner(System.in);
        int num=sc.nextInt();
        int i=0;
        for(i=31;i>=1;i-=2){
            System.out.printf(((num>>i)&1)+"");
        }
        System.out.println();
        for(i=30;i>=0;i-=2){
            System.out.printf(((num>>i)&1)+"");
        }
    }*//*
 *//*   public static void main2(String[] args){
        String Password="123456";
        int attempts=0;
        Scanner sc=new Scanner(System.in);
        while(attempts<3){
            System.out.println("请输入密码：");
            String userPassword=sc.nextLine();
            if(Password.equals(userPassword)){
                System.out.println("登录成功");
                break;
            }
            else{
                System.out.println("密码错误");
                attempts++;
            }
            if(attempts==3){
                System.out.println("三次密码均输入错误，退出程序");
            }
        }
        sc.close();
    }*//*
  *//*  public static void imtegers(int x){
        System.out.print(x%10);
        if(x<10){
            return ;
        }
        imtegers(x/10);
        return ;
    }
    public static void main3(String[] args){
        Scanner sc=new Scanner(System.in);
        int num=sc.nextInt();
        imtegers(num);
    }*//*
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=i;j++){
                System.out.print(i+"*"+j+"="+i*j+"  ");
            }
            System.out.println();
        }
    }
}*/
public class TestDemo{
    public static int frequency(int[] a){
        int i=0;
        int temp=0;
        for(i=0;i<a.length;i++){
            temp^=a[i];
        }
        return temp;
    }

    public static int fibonacci(int x){
        if(x==1||x==2){
            return 1;
        }
        return fibonacci(x-1)+fibonacci(x-2);
    }
/*    public static void main(String[] args){*/
       /* int[] arr={1,1,3,2,3,2,5};
        System.out.println(frequency(arr));*//*
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入斐波那契数列的第n项:");
        int n=sc.nextInt();
        System.out.println(fibonacci(n-1));*/
    /*}*/
//    public static int factorialAnd(int a){
//        if(a==1){
//            return 1;
//        }
//        return a*factorialAnd(a-1);
//    }
//    public static void main(String[] args) {
//        Scanner sc = new Scanner(System.in);
//        int n = sc.nextInt();
//        int sum=0;
//        for(int i=1;i<=n;i++) {
//            sum=sum+factorialAnd(i);
//        }
//        System.out.println(sum);
       /* System.out.println(factorialAnd(n));*/
    /*}*/
        public static void Sort(int arr[]){
            int len=arr.length;
            int i,j;
            int temp;
            for(i=0,j=len-1;i!=j;){
                if(arr[i]%2==0){
                    if(arr[j]%2!=0){
                        temp=arr[i];
                        arr[i]=arr[j];
                        arr[j]=temp;
                    }
                    else{
                        j--;
                    }
                }
                else{
                    i++;
                }
            }
        }
        public static void main(String[] args){
           int arr[]={1,2,3,4,5,7,8};
           Sort(arr);
           for(int i:arr){
               System.out.print(i+" ");
           }
       }
}
